//
//  ConversationListViewModel.m
//  MiaoCircle
//
//  Created by 许正荣 on 2018/5/25.
//  Copyright © 2018年 acgera. All rights reserved.
//

#import "MHConversationListViewModel.h"
#import "MHChatViewModel.h"
#import "MHMomentViewModel.h"
#import "MHRecentMessageViewModel.h"
#import "MHSystemMessageViewModel.h"
#import "MHNewMemberViewModel.h"
#import "MHAttributeTableViewModel.h"
#import "MHIMMessageTransferHelper.h"
#import "MHPushModel.h"
@implementation MHConversationListViewModel
-(void)initialize
{
    [super initialize];
    self.title = @"消息";
    @weakify(self);
    self.pushToChatView = [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id input) {
        MHChatViewModel *viewModel = [[MHChatViewModel alloc] initWithServices:self.services params:@{MHViewModelUtilKey:input}];
        [self.services pushViewModel:viewModel animated:YES];
        return [RACSignal empty];
    }];
    
    self.pushToSystemMeCommand = [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id input) {
        [[MHIMMessageTransferHelper sharedInstance] resetAllreadWithKey:NSStringFromClass([MHPushModel class])];
        MHSystemMessageViewModel *viewModel = [[MHSystemMessageViewModel alloc] initWithServices:self.services params:nil];
        [self.services pushViewModel:viewModel animated:YES];
        return [RACSignal empty];
    }];
    
    self.pushToNewMemberCommand = [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id input) {
        MHNewMemberViewModel *viewModel = [[MHNewMemberViewModel alloc] initWithServices:self.services params:nil];
        [self.services pushViewModel:viewModel animated:YES];
        return [RACSignal empty];
    }];
    
    self.pushToAttriCommand = [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id input) {
        MHAttributeTableViewModel *viewModel = [[MHAttributeTableViewModel alloc] initWithServices:self.services params:nil];
        [self.services pushViewModel:viewModel animated:YES];
        return [RACSignal empty];
    }];
    
    
    self.collectionCommand = [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id input) {
        MHMomentViewModel *viewModel = [[MHMomentViewModel alloc] initWithServices:self.services params:@{MHViewModelIsCollection:@(true),MHViewModelTitleKey:@"收藏"}];
        [self.services pushViewModel:viewModel animated:YES];
        return [RACSignal empty];
    }];
    
    self.releationToMeCommand = [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id input) {
        MHRecentMessageViewModel *viewModel = [[MHRecentMessageViewModel alloc] initWithServices:self.services params:nil];
//        viewModel.userId = [MHHTTPService sharedInstance].currentUser.userId;
        [self.services pushViewModel:viewModel animated:YES];
        return [RACSignal empty];
    }];
}
@end
